package jm.nj.demo06main.demo01;

import org.omg.CORBA.ARG_OUT;

import java.util.Date;

/*
*Date类成员方法
*       viod setTime(long time):把毫秒值转换为Date日期
*       long getTime():把Date日期转换为毫秒值
* */
public class Demo02Date {
    public static void main(String[] args) {
        method_01();
        method_02();


    }
/*
* long getTime():把date日期转换为毫秒值
* 相当于
* Syetem.currentTimeMillis();
* */
    private static void method_02() {
        Date date = new Date();
        long l = date.getTime();
        System.out.println(l);
        long s= System.currentTimeMillis();
        System.out.println(s);
    }

    /*
* void setTime(long time):把毫秒值转换为Date日期
* 相当于Date类的带参构造
* Date(long date):作用把毫秒值,转换为日期
* */
    private static void method_01() {
        Date date = new Date();
        System.out.println(date);

        date.setTime(0L);
        System.out.println(date);

        date.setTime(42342342134124124L);
        System.out.println(date);
    }
}
